From: Jan Beulich Date: Thu, 26 May 2016 16:26:24 +0000 (+0100) Subject: x86/compat: correct SMEP/SMAP NOPs patching X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1084 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=f5610009529628314c9d1d52b00715fe855fcf06;p=xen.git x86/compat: correct SMEP/SMAP NOPs patching Correct the number of single byte NOPs we want to be replaced in case neither SMEP nor SMAP are available. Also simplify the expression adding these NOPs - at that location . equals .Lcr4_orig, and removing that part of the expression fixes a bogus ".space or fill with negative value, ignored" warning by very old gas (which actually is what made me look at those constructs again). Signed-off-by: Jan Beulich Reviewed-by: Wei Liu Reviewed-by: Andrew Cooper Release-acked-by: Wei Liu --- diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S index e7a268615e..7f02afd173 100644 --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -175,7 +175,7 @@ compat_bad_hypercall: ENTRY(compat_restore_all_guest) ASSERT_INTERRUPTS_DISABLED .Lcr4_orig: - .skip (.Lcr4_alt_end - .Lcr4_alt) - (. - .Lcr4_orig), 0x90 + .skip .Lcr4_alt_end - .Lcr4_alt, 0x90 .Lcr4_orig_end: .pushsection .altinstr_replacement, "ax" .Lcr4_alt: @@ -200,7 +200,8 @@ ENTRY(compat_restore_all_guest) jne 1b .Lcr4_alt_end: .section .altinstructions, "a" - altinstruction_entry .Lcr4_orig, .Lcr4_orig, X86_FEATURE_ALWAYS, 12, 0 + altinstruction_entry .Lcr4_orig, .Lcr4_orig, X86_FEATURE_ALWAYS, \ + (.Lcr4_orig_end - .Lcr4_orig), 0 altinstruction_entry .Lcr4_orig, .Lcr4_alt, X86_FEATURE_SMEP, \ (.Lcr4_orig_end - .Lcr4_orig), \ (.Lcr4_alt_end - .Lcr4_alt)